Detect if the browser supports cookies
function Checkcookie () {
To determine whether a cookie is turned on
var cookieenabled= (navigator.cookieenabled)? True:false;
If the browser is not ie4+ or ns6+
if (typeof navigator.cookieenabled== "undefined" !cookieenabled) {
Document.cookie= "TestCookie";
Cookieenabled= (document.cookie== "TestCookie")? True:falsedocumen
Sample Code used to determine whether the client browser supports cookies
This article describes the sample code used to determine whether the client browser supports cookies. For more information, see.
1.
The Code is as follows:
Function check (){
If (window. navigator. cookieEnabled)
Return true;
Else {
Alert ("browser configuration error, Cookie unavailable! ");
Return false ;}
}
2.
The Code is as follows:
SetCookie ('cookie _ test', '1 ');
Var c
This article describes the sample code used to determine whether the client browser supports cookies. For more information, see.
The Code is as follows:
Function check (){If (window. navigator. cookieEnabled)Return true;Else {Alert ("browser configuration error, Cookie unavailable! ");Return false ;}}
2.
The Code is as follows:
SetCookie ('cookie _ test', '1 ');Var cookie_test = getCookie ('cookie _ test ');If ('1 '! = Cookie_test){Alert ('unsuppo
[Nonsense]* LoadXMLDoc parameters: the data to be passed in the form [Nonsense]*/
New Ajax ('login. php', login. checkLogin). loadXMLDoc ({Username: document. getElementById ('username'). value,Password: document. getElementById ('Password'). value,Vcode: document. getElementById ('vcode'). value});
3. Select display and hide, and cookie operations.Since select cannot be blocked by div, let's take it out!
Var Select = {Show: function (){Var selects = document. getElementsByTagName ('select ');F
, you only need to know what to do, and someone has already done it for you.I searched the forum and foundHttp://www.phpchina.com/bbs/view... a = page = 1 sid = 4jSn3r
Var Cookie ={Check: function (){// Determine whether the cookie is enabledVar cookieEnabled = (navigator. cookieEnabled )? True: false;// If the browser is not ie4 + or ns6 +If (typeof navigator. cookie
parameters, data to be passed in the form [nonsense]*/
New Ajax (' login.php ', Login.checklogin). Loadxmldoc ({Username:document.getElementById (' username '). Value,Password:document.getElementById (' password '). Value,Vcode:document.getElementById (' Vcode '). Value});
3. Display and hide of select, and cookie manipulation.Now that select can't be blocked by Div, kill him!
var select={Show:function () {var selects=document.getelementsbytagname (' select ');for (Var m=0;m
},Hide:functi
the form [nonsense]*/
New Ajax (' login.php ', Login.checklogin). Loadxmldoc ({Username:document.getElementById (' username '). Value,Password:document.getElementById (' password '). Value,Vcode:document.getElementById (' Vcode '). Value});
3. Display and hide of select, and cookie operation.Since the select cannot be blocked by Div, then kill him!
Var select={ show:function () { var selects=document.getelementsbytagname (' select ') ; for (Var m=0;m }, hide:function () { var sele
Delcookie (name)//Delete cookie
{
var exp = new Date ();
Exp.settime (Exp.gettime ()-1);
var cval=getcookie (name);
if (cval!=null) document.cookie= name + "=" +cval+ "; expires=" +exp.togmtstring ();
}
3.
Copy Code code as follows:
var cookieenabled= (navigator.cookieenabled)? true:false
// Determine if the cookie is open
//If the browser is not ie4+ or ns6+
if (typeof navigator.cookieenabled== undefined "!
How JavaScript determines whether the current browser supports cookies:Browsers support cookies by default, but they can also be artificially disabled.The code is as follows:function Check () { if(window.navigator.cookieEnabled) { return True; } Else { alert ("browser has disabled cookies"); return false ; } }The function above can be used to verify the effect of cookies.The Cookieenabled property can be found in the
Now, the attributes and methods of browser objects are almost the same. You can test your browser according to the Demo below to see the details of your browser.
Today, we continue to introduce the browser (Navigator) object with the last window object. Navigator mainly returns some information about the browser. Next let's take a look at its attributes and methods, and finally give a Demo.
Navigator Object Attributes
AppCodeName: return the code name of the browser.
AppName: returns the brows
The Navigator object contains information about the browser:
appCodeName--A string representation of the browser code name
AppName--A string representation of the official browser name
AppVersion--A string representation of browser version information
Cookieenabled--Returns True if cookie is enabled, FALSE otherwise
Javaenabled--Returns True if Java is enabled, otherwise false
Platform--a string representation of the compu
Navigator--navigator objects are typically used to detect browser and operating system versions
Navigator, Chinese "navigator"
Citation URL: http://www.dreamdu.com/javascript/window.navigator/
Navigator object is a property of the Window object
Because navigator does not have a uniform standard, each browser has its own version of Navigator, which only describes the most commonly supported and most common
Common Navigator Properties
appCodeName--A string representation of t
The Navigator object contains information about the browser:
appCodeName--a string representation of the browser code name
AppName--a string representation of the official browser name
appversion--string representation of browser version information
cookieenabled-returns False if the Enable cookie returns True
javaenabled-Returns False if Java is enabled to return True
platform--a string representation of the computer platform on which the brows
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.